package com.yootk.service.config;

import feign.Logger;
import feign.RequestInterceptor;
import org.springframework.context.annotation.Bean;

public class FeignConfig { // 定义Feign配置类
    @Bean
    public Logger.Level level() {
        return Logger.Level.FULL; // 输出完全的日志信息
    }
    @Bean
    public RequestInterceptor getFeignRequestInterceptor() {    // 请求拦截器
        return (template -> {
            template.header("serviceName", "pc");
            // 将系统JVM进程保存的Token数据发送到目标请求端
            template.header("yootk-token", System.getProperty("yootk.token"));
        });
    }
}
